import store from '@/store/index'
import * as mutationsTypes from '@/store/mutations-types'

//登录注册的路由
export default [
  {
    path: '/movieDetail',
    name: 'movieDetail',
    component: () => import('@/views/movie/movie_detail/MovieDetail'),
    children: [
      {
        //电影简介
        path: 'introduce',
        name: 'introduce',
        props: true,
        component: () => import('@/views/movie/movie_detail/down_info/introduce/Introduce'),
        beforeEnter: (to, from, next) => {
          console.log('从哪儿来: ' + from.path)
          console.log('到哪儿去: ' + to.path)
          window.document.title = '电影简介'
          store.commit(mutationsTypes.EXCHANGE_MOVIE_DETAIL_NAV_ACTIVE_INDEX, '1')
          store.commit(mutationsTypes.EXCHANGE_HOME_NAV_ACTIVE_INDEX, '0')
          next()
        }
      },
      {
        //演职人员
        path: 'actors',
        name: 'actors',
        component: () => import('@/views/movie/movie_detail/down_info/actors/Actors'),
        beforeEnter: (to, from, next) => {
          console.log('从哪儿来: ' + from.path)
          console.log('到哪儿去: ' + to.path)
          window.document.title = '电影简介'
          store.commit(mutationsTypes.EXCHANGE_MOVIE_DETAIL_NAV_ACTIVE_INDEX, '2')
          store.commit(mutationsTypes.EXCHANGE_HOME_NAV_ACTIVE_INDEX, '0')
          next()
        }
      },
      {
        //奖项
        path: 'awards',
        name: 'awards',
        component: () => import('@/views/movie/movie_detail/down_info/awards/Awards'),
        beforeEnter: (to, from, next) => {
          console.log('从哪儿来: ' + from.path)
          console.log('到哪儿去: ' + to.path)
          window.document.title = '电影简介'
          store.commit(mutationsTypes.EXCHANGE_MOVIE_DETAIL_NAV_ACTIVE_INDEX, '3')
          store.commit(mutationsTypes.EXCHANGE_HOME_NAV_ACTIVE_INDEX, '0')
          next()
        }
      },
      {
        //图集
        path: 'pictures',
        name: 'pictures',
        component: () => import('@/views/movie/movie_detail/down_info/pictures/Pictures'),
        beforeEnter: (to, from, next) => {
          console.log('从哪儿来: ' + from.path)
          console.log('到哪儿去: ' + to.path)
          window.document.title = '电影简介'
          store.commit(mutationsTypes.EXCHANGE_MOVIE_DETAIL_NAV_ACTIVE_INDEX, '4')
          store.commit(mutationsTypes.EXCHANGE_HOME_NAV_ACTIVE_INDEX, '0')
          next()
        }
      },
    ]
  },
  {
    path: '/movieList',
    name: 'movieList',
    component: () => import('@/views/movie/movie_list/MovieList'),
    beforeEnter: (to, from, next) => {
      console.log('从哪儿来: ' + from.path)
      console.log('到哪儿去: ' + to.path)
      window.document.title = '电影列表'
      store.commit(mutationsTypes.EXCHANGE_HOME_NAV_ACTIVE_INDEX, '2')
      next()
    }
  },
  //榜单
  {
    path: '/movieMonthlyFocus',
    name: 'movieMonthlyFocus',
    component: () => import('@/views/movie/movie_monthly_focus/MovieMonthlyFocus'),
    beforeEnter: (to, from, next) => {
      console.log('从哪儿来: ' + from.path)
      console.log('到哪儿去: ' + to.path)
      window.document.title = '榜单'
      store.commit(mutationsTypes.EXCHANGE_HOME_NAV_ACTIVE_INDEX, '4')
      next()
    }
  },
]
